package com.mentalhealthplatform.global.rbac.dto.request;

import com.mentalhealthplatform.utils.decryptUtils.field.Decrypt;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
public class AuthRequest {

    @Decrypt
    @NotBlank(message = "用户名不能为空")
    @Size(min = 3, max = 20)
    @Pattern(regexp = "^[a-zA-Z0-9]+$")
    private String username;

    @Decrypt
    @NotBlank(message = "密码不能为空")
    @Size(min = 6, max = 15)
    @Pattern(regexp = "^[a-zA-Z0-9!@#$%^&*()_+\\[\\]{};':\"\\\\|,.<>/?-]+$")
    private String password;

    // 默认构造函数
    public AuthRequest() {
    }

    // 带参数的构造函数
    public AuthRequest(String username, String password) {
        this.username = username;
        this.password = password;
    }



    @Override
    public String toString() {
        return "AuthRequest{" +
                "username='" + username + '\'' +
                ", password='[PROTECTED]'}"; // 为了安全性，隐藏密码
    }

}
